<?php
include '../controllers/getMachine.php';
include '../controllers/getMachineList.php';
$exam = $_REQUEST['exam'];
$readMachines = getMachineByExamAndType($exam, 1);
$logicMachines = getMachineByExamAndType($exam, 2);
$writeMachines = getMachineByExamAndType($exam, 3);
$mathMachines = getMachineByExamAndType($exam, 4);
$machineList = getMachineListByExam($exam);

$machineListJson = json_encode($machineList);
$readJson = json_encode($readMachines);
$logicJson = json_encode($logicMachines);
$writeJson = json_encode($writeMachines);
$mathJson = json_encode($mathMachines);

echo "{\"machineList\":".$machineListJson.",\"read\":".$readJson.",\"logic\":".$logicJson.",\"write\":".$writeJson.",\"math\":".$mathJson."}";

?>